import java.util.ArrayList;
import java.util.Iterator;

public class RecorreArrayList {

	private ArrayList<String> arrayList = null;
	// private Iterator<String> iterator = null;

	ArrayList<RecorreArrayList> ArrayList = new ArrayList<RecorreArrayList>();

	void show() {

		System.out.println(arrayList);
	}

	// muestra el arrayList mediante un iterator con el bucle while
	void shoWithIterator() {
		Iterator<String> it = arrayList.iterator();

		while (it.hasNext())
			System.out.print("\t" + it.next());
	}

	// muestra el arraylist mediante un iterador con bucle for

	void shoWIterator2() {
		for (Iterator<String> it = arrayList.iterator(); it.hasNext();)
			System.out.print("\t" + it.next());
	}

	// muestra el arraylist mediante un for clasico accediendo mediante la
	// posicion indices

	void shoWithGet() {
		for (int i = 0; i < arrayList.size(); i++)
			System.out.print("\t" + arrayList.get(i));
	}

	// muestra el arraylist mediante un for mejorado

	void shoWithForEach() {
		for (String elemento : arrayList)
			System.out.print("\t" + elemento);
	}

}